package com.example.mvpdemo.simple6;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.mvpdemo.R;
import com.example.mvpdemo.simple6.base.BaseFragment6;

public class LoginFragment6 extends BaseFragment6<LoginView6,LoginPresnter6> implements LoginView6 {


    @Override
    public LoginPresnter6 creatPresnter() {
        return new LoginPresnter6();
    }

    @Override
    public LoginView6 creatView() {
        return this;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_main, null);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        view.findViewById(R.id.btnLogin).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                getPresnter().login("","");
            }
        });
    }

    @Override
    public void onLoginResult(String ret) {
        Toast.makeText(getContext(), ret, Toast.LENGTH_SHORT).show();
    }

}
